﻿///***************************************************************
/// 시  스  템 : Updms.Car.Dac
/// 단위시스템 : CAR
/// 계      층 : Data Access Layer
/// 프로그램명 : Car_Dac_UPDMS_CAR_SERVICE
/// 파  일  명 : Car_Dac_UPDMS_CAR_SERVICE.cs
/// 설      명 : 정비관리
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-08-26 송시명   최초 작성
///***************************************************************
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
using System.Runtime.InteropServices;

using SMFramework.Data;

namespace Updms.Car.Dac
{
	[ComVisible(true)]
	[Transaction(TransactionOption.Supported)]
	[JustInTimeActivation(true)]
	public class Car_Dac_UPDMS_CAR_SERVICE : Base.AppFramework.DacBase
	{
		public Car_Dac_UPDMS_CAR_SERVICE()
		{
		}

		#region NT [GetSearchCount]
		
		[AutoComplete]
		public int GetSearchCount(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_CAR_SERVICE_Get_Search_Count";
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			
			return (int)_agent.ExecuteScalar(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [SelectProcess]
		
		[AutoComplete]
		public DataSet SelectProcess(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_CAR_SERVICE_Select_Paging";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			
			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_CAR_SERVICE", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion		
		
		#region NT [GetLastServiceInfo]

		/// <summary>
		/// 마지막 정비일의 정보(정비일,누적주행거리)
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetLastServiceInfo(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_CAR_SERVICE_Get_Last_Service_Info";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_CAR_SERVICE", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion		
		
		#region NT [GetNewServiceId]

		[AutoComplete]
		public string GetNewServiceId()
		{
			string ls_sql = "usp_UPDMS_CAR_SERVICE_Get_New_Service_Id";

			return (string)_agent.ExecuteScalar(ls_sql, null, CommandType.StoredProcedure);
		}

		#endregion
		

		#region RT [Insert]
		
		[AutoComplete]
		public int Insert(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_CAR_SERVICE_Insert";
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [Update]
		
		[AutoComplete]
		public int Update(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_CAR_SERVICE_Update";
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [Delete]
		
		[AutoComplete]
		public int Delete(string ls_xml)
		{
			string strSql = "usp_UPDMS_CAR_SERVICE_Delete";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml)
			};
			
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion
	}
}
